#include<bits/stdc++.h>
using namespace std;
int read(){
    int x=0,f=1;
    char c='\0';
    while(c!='-'&&(c<'0'||c>'9'))c=getchar();
    while(c=='-'){f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
int n,r[100010],tmp;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(int i=0;i<n;i++)r[read()]++;
    tmp=0;
    for(int i=0;i<=100000;i++){
        if(r[i]){
            if(r[i]>tmp){
                n-=tmp;
                tmp=r[i];
            }
            else n-=r[i];
        }
    }
    printf("%d\n",n);
    return 0;
}
